<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<script>
    console.log(111);
    function fn(cb) {
        setTimeout(() => {
            console.log(222);
            cb && cb();
        }, 1000)
    }
    fn(function () {
        console.log(333);
    });
</script>
</body>
</html>
